import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/3/23
 * Time: 10:52
 * Description: No Description
 */

public class TestDemo {
    public static int popo(int[] array) {
        int sum = 0;
        for (int i = 0; i < array.length;i++) {
            sum^=array[i];
        }
        return sum;
    }
    public static void main(String[] args) {
        int[] array = {1,2,3,4,1,3,4,5,5};
        System.out.println(popo(array));
    }
    public static void swap(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            boolean x = true;
            for (int j = 0; j < array.length - 1 - i; j++) {
                if(array[j] > array[j+1]) {
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                    x = false;
                }
            }
            if(x){
                break;
            }
        }
    }
    public static void main4(String[] args) {
        int[] arr = {1,3,7,9,2,4,5,8,10};
        swap(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static boolean sever(int[] array) {
        boolean a = true;
        for (int i = 0; i < array.length-1; i++) {
            if(array[i] > array[i+1]) {
                a = false;
                break;
            }
        }
        return a;
    }
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] array = new int[10];
        for(int i = 0; i < array.length; i++) {
            array[i]=scan.nextInt();
        }
        boolean x = sever(array);
        if(x) {
            System.out.println("有序");
        } else {
            System.out.println("无序");
        }
    }
    public static int Swap(int[] array , int k) {
        int left = 0;
        int right = array.length-1;
        while(left <= right) {
            int mid = (left + right) / 2;
            if(array[mid] < k) {
                left = mid + 1;
            } else if(array[mid] > k) {
                right = mid - 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
    public static void main1(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        int Key = 5;
        int index = Swap(arr, Key);
        if (index > 0) {
            System.out.println("找到了，这个数的下标是" + index);
        } else {
            System.out.println("没找到");
        }
    }
    public static void main2(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8};
        //打印数组的三种方式

        //第一种
        for(int i = 0;i < arr.length;i++) {
            System.out.print(arr[i] + " ");
        }
        //第二种
        System.out.println();
        for(int x : arr) {
            System.out.print(x + " ");
        }
        //第三种
        System.out.println();
        System.out.print(Arrays.toString(arr));
    }
}